var id=""
$(document).ready(function(){
	id=$("#id").val();
//	findProject();
//	findReportList();
});

//验证提交表单
function submitForm() {
	var kedaoForm = $(".kedaoForm").Validform({
		tiptype: 3
	});
	kedaoForm.check();
	kedaoForm.submitForm(false);
}

function findProject(){
	$.ajax({
   		async:false,
		url:'/admin/report/report!findProject.action',
		type:'POST',
		data:{
			id:id
		},
		dataType:'json',
		cache: false,
		success:function(data){
			Interceptor(data);
			if(data!=null){
				$("#name").html(data.name);
			}
		}
	});
}
function findReportList(){
	$.ajax({
		async:false,
		url:'/admin/report/report!findReportList.action',
		type:'POST',
		data:{
			id:id
		},
		dataType:'json',
		cache: false,
		success:function(data){
			Interceptor(data);
			var resultContent='<tr><th scope="col">备案日期</th><th scope="col">人员招募情况</th><th scope="col">论文发表情况</th><th scope="col">项目年度报告</th><th scope="col">操作</th></tr>';
			if(data!=null){
				$(data).each(function(i) {
					resultContent+='<tr class="odd">';
					resultContent+='<td align="center">'+data[i].recordsDate+'</td>';
					var personRecruit=data[i].personRecruit;
					if(personRecruit.length>10){
						personRecruit=personRecruit.substring(0,7)+'...';
					}
					resultContent+='<td align="center">'+personRecruit+'</td>';
					resultContent+='<td align="center"><a href="'+data[i].paperFilePath+'">查看附件</a></td>';
					var annualReport=data[i].annualReport;
					if(annualReport.length>10){
						annualReport=annualReport.substring(0,7)+'...';
					}
					resultContent+='<td align="center">'+annualReport+'</td>';
					resultContent+='<td align="center"><a href="project_report_detail.jsp?id='+data[i].id+'">查看详情</a></td>';
					resultContent+='</tr>';
				});
			}
			$("#dataarea").html(resultContent);
		}
	});
}
//上传文件
KindEditor.ready(function(K) {

	var editor = K.editor({
		uploadJson : '/js/kindeditor-4.1.10/jsp/upload_json.jsp'
		//fileManagerJson : '/assets/plugins/kindeditor-4.1.10/jsp/file_manager_json.jsp',
		//allowFileManager : true
	});
	
		
	K('#btn_approvalFilePath').click(function() {
		editor.loadPlugin('image', function() {
			editor.plugin.imageDialog({
				showRemote : false, //隐藏图片浏览
				imageUrl : K('#filePath').val(),
				clickFn : function(url, title, width, height, border, align) {
					K('#filePath').val(url);
					$("#tteeFilePath_span").html('<a href="' + url + '" target="_blank" title="' + title + '">' + title + '</a>'); 
					editor.hideDialog();
				}
			});
		});
	});

}); 